/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package CapaLogica;

/**
 *
 * @author Amejia
 */
public class Atencion {
    
    //Atributos propios
    private String dias;
    private String hora;
    private String local;
    private String idCongregacion;//Levanta objeto
    
    //Atribuos de relacion
    private Congregacion objCongregacion;
    
    //Constructor

    public Atencion(String dias, String hora,String local, String idCongregacion) {
        this.dias = dias;
        this.hora = hora;
        this.local=local;
        this.idCongregacion = idCongregacion;
    }
    
    
    //Acceso a la clase

    public String getDias() {
        return dias;
    }

    public void setDias(String dias) {
        this.dias = dias;
    }

    public String getHora() {
        return hora;
    }

    public void setHora(String hora) {
        this.hora = hora;
    }

    public String getIdCongregacion() {
        return idCongregacion;
    }

    public void setIdCongregacion(String idCongregacion) {
        this.idCongregacion = idCongregacion;
    }

    public String getLocal() {
        return local;
    }

    public void setLocal(String local) {
        this.local = local;
    }

    private void setObjCongregacion(Congregacion objCongregacion) {
        this.objCongregacion = objCongregacion;
    }
    
    

    public Congregacion getObjCongregacion() throws Exception {
        if(objCongregacion==null){
           setObjCongregacion(new MultiCongregacion().buscarPorCodigo(getIdCongregacion()));
        }
        return objCongregacion;
    }
    
   //Metodos
   public String toString(){
        String result="Dias : "+getDias()
                    +"Hora: "+getHora()
                    +"Local: "+getLocal();
       return result;             
    }
    
    
}
